package com.tybbank.Adapter;

import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.tybbank.Activity.NoticeActivity;
import com.tybbank.Bean.Model01;
import com.tybbank.R;
import com.taobao.library.BaseBannerAdapter;
import com.taobao.library.VerticalBannerView;
import java.util.List;

/**
 * Created by Administrator on 2017/11/21.
 */

public class SampleAdapter extends BaseBannerAdapter<Model01> {
    private List<Model01> datas01;
    private Context context;

    public SampleAdapter(List<Model01> datas, Context context) {
        super(datas);
        this.datas01 = datas;
        this.context = context;
    }


    @Override
    public View getView(VerticalBannerView parent) {
        return LayoutInflater.from(parent.getContext()).inflate(R.layout.your_item,null);
    }

    @Override
    public void setItem(final View view, final Model01 data) {
        TextView textView = (TextView) view.findViewById(R.id.text);
        textView.setText(data.title);
        // 你可以增加点击事件
        view.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent  intent = new Intent(context, NoticeActivity.class);
                intent.putExtra("type", "1");
                intent.putExtra("title", "公告");
                context.startActivity(intent);

            }
        });
    }
}